﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using Jzy.Workflow.Flow;
using Jzy.Core.Common.Web;
using Frame.Lib.Web;
using Frame.Lib.Enums;
using Frame.Lib.Core.Dict;

namespace Jzy.Web.WorkFlow.Fore
{
   
    public partial class NewList : PageList
    {
        private string _typeCode;
        protected string TypeCode
        {
            get
            {
                if (string.IsNullOrEmpty(Request["TypeCode"]))
                {
                    return _typeCode;
                }
                else
                {
                    return Request["TypeCode"];
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        { 
            CssFileManager.AddCssFile(CssFile.tab1);
            if (!IsPostBack)
            {
                BindData();
            }
        }
        protected string GetClassName(object code)
        {
            if (code.ToString() == TypeCode)
            {
                return "on";
            }
            else
            {
                return "";
            }
        }
        private void BindData()
        {
           
            DictBO dict = new DictBO();
            IEnumerable<DictInfo> lst = dict.GetList(DictItem.流程类型);
            
            if (string.IsNullOrEmpty(TypeCode))
            {
                if (lst.Count() > 0)
                {
                    _typeCode = lst.First().Code.ToString();
                }
            }

            rptHead.DataSource = lst;
            rptHead.DataBind();           

            FlowBO flow = new FlowBO();
            List<FlowInfo> list = flow.GetList(TypeCode);
            lv.DataSource = list;
            lv.DataBind();
        }
    }
}
